package DBConection;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import oracle.jdbc.*;
public class ConexionBD {

    private static Connection con = null;
    private static String Nombre_BD =  "DAS";
    
    
    public static String getNombre_BD() {
		return Nombre_BD;
	}

	public static Connection getConnection() {
        if (con != null)
            return con;
        else {
           
        	
        	try {
        		
                String driver = "oracle.jdbc.OracleDriver";
                String url = "jdbc:oracle:thin:@localhost:1521:XE";
                String user = "SYSTEM";
                String password = "root";
                Class.forName(driver);
                //DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
                con = DriverManager.getConnection(url, user, password);
            } catch (ClassNotFoundException cnfe) {
                System.out.println(cnfe);
            } catch (SQLException sqe) {
                System.out.println(sqe);
            } 
            return con;
        }

    }
}